package com.hansming.bss.modules.sfc.service;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hansming.bss.common.service.CrudService;
import com.hansming.bss.modules.sfc.dao.LineDao;
import com.hansming.bss.modules.sfc.entity.Line;
import com.hansming.bss.modules.sfc.entity.LineExtr;
import com.hansming.bss.modules.sfc.util.PageBean;

/**
 * 线路Service
 * @author Hansming
 * @version 2017-09-19
 */
@Service
@Transactional(readOnly = true)
public class LineService extends CrudService<LineDao,Line> {
	
	@Autowired
	private LineDao lineDao;
	
		//查找在主页下方导航栏中的线路集合（有可能变化）
		public List<Line> findFirstPageLineInMenu(){
			return lineDao.findFirstPageLineInMenu();
		}
	
		//查找在主页中间导航栏中的线路集合
		public List<Line> findFirstPageLineInNav(){
			return lineDao.findFirstPageLineInNav();
		}
	
		//查找对应线路分类的线路集合
		public List<Line> findtypeLines(String typeid){
			return lineDao.findtypeLines(typeid);
		}
		
		//根据条件搜寻线路
		public List<Line> search(String city,int days,int startmonth,int endmonth,int month,String startprice,String endprice,int sortid,int orderid,PageBean page){
			return lineDao.search(city, days, startmonth, endmonth, month,startprice, endprice,sortid,orderid,page);
		}
		
		//根据类别查找在首页的线路
		public List<Line> getLineByTypeInIndex(String type){
			return lineDao.getLineByTypeInIndex(type);	
		}
		
		//根据类别查找在线路首页的线路
		public List<Line> getLineBytypeInLinePage(String type){
			return lineDao.getLineBytypeInLinePage(type);
		}
		
		@Transactional(readOnly = false)
		public void saveallinfo(Line line){
			lineDao.saveallinfo(line);
		}
		
		
		//=====================只用于线路后台操作的Dao=================
		@Transactional(readOnly = false)
		public void updateShowOrHideInList(Line line){
			lineDao.updateShowOrHideInList(line);
		}
		
		//设置该线路为首页菜单显示的线路
		@Transactional(readOnly = false)
		public int updateLineInMenu(Line line){
			return lineDao.updateLineInMenu(line);
		}
		
		//取消设置该线路为首页菜单显示的线路
		@Transactional(readOnly = false)
		public int deleteLineInMenu(Line line){
			return lineDao.deleteLineInMenu(line);
		}

		//设置该线路为首页导航栏的线路
		@Transactional(readOnly = false)
		public int updateLineInNav(Line line){
			return lineDao.updateLineInNav(line);
		}
		
		//取消设置气味首页导航栏的线路
		@Transactional(readOnly = false)
		public int deleteLineInNav(Line line){
			return lineDao.updateLineInNav(line);
		}
		
		//设置线路列表页的综合排序
		@Transactional(readOnly = false)
		public int setSort(Line line){
			return lineDao.setSort(line);
		}
		//==========================小程序线路Service======================
		public List<Line> getlineinminiappindexpage(PageBean page){
			return lineDao.getlineinminiappindexpage(page);
		}

		
		//线路首页搜索
		public List<Line> getthreelineInLineIndex(){
			return lineDao.getthreelineInLineIndex();
		}
		
		//线路首页
		public List<Line> getLineInIndexByType(String type,PageBean pagebean){
			return lineDao.getLineInIndexByType(type,pagebean);
		}
		
		
		//小程序搜索方法Service
		public List<Line> miniappsearchlines(String type,int days,int orderid,int sortid,String begindate,String enddate){
			return lineDao.miniappsearchlines(type, days, orderid, sortid, begindate, enddate);
		}


		
		@Transactional(readOnly = false)
		public void savedetails(String details,String id){
			lineDao.savedetails(details,id);
		}

	//========================PcService======================
		//PC首页线路上方导航栏的线路
		public List<Line> IndexLine(){
			return lineDao.IndexLine();
		}
		
		
		//PC首页线路下方导航栏
		public List<Line> getLinesByType(String type){
			return lineDao.getLinesByType(type);
		}
		
		//PC线路首页根据类型和需要返回的数目确定返回产品
		public List<Line> getindexlineinfo(String type,Integer num){
			return lineDao.getindexlineinfo(type, num);
		}
		
		//pc线路首页根据需要返回的数目确定返回产品
		public List<Line> getindexhotinfo(Integer num){
			return lineDao.getindexhotinfo(num);
		}
		
		//pc线路列表页搜索接口
		public List<Line> getlinelistinfo(String city,Integer days,String starttime,String endtime,Integer startprice,Integer endprice,Integer selecttype,Integer order,PageBean page){
			return lineDao.getlinelistinfo(city,days,starttime,endtime,startprice,endprice,selecttype,order,page);
		}
		
		//pc线路列表页搜索接口
		public List<Line> getlinelistinfoall(String city,Integer days,String starttime,String endtime,Integer startprice,Integer endprice,Integer selecttype,Integer order){
			return lineDao.getlinelistinfoall(city,days,starttime,endtime,startprice,endprice,selecttype,order);
		}
		
		//pc线路详情页基本线路信息接口
		public Line getlinedetailinfo(String lineid) {
			return lineDao.getlinedetailinfo(lineid);
		}
		
		
		
}
